*********************************************************************************
* Ergebnisse zum Abschnitt "Unterstützung von Kernaussagen"						*
*********************************************************************************

* Project: 	Sonderheft ZfP
* Authors: 	Matthias Mader
* Date:		Jan 2025

* Data: secEUrity Project, IPSOS supplementary survey 2024

*********************************************************************************

*** Setup
	clear
	set more off            						// Disable partitioned output
	set dp period									// Use comma instead of dot for decimals
	set linesize 80         						// Line size limit to make output more readable
	macro drop _all         						// clear all macros
	set scheme burd, permanent						// set graph scheme, e.g., cleanplots, plottig, plotplainblind, burd3, s1mono
	graph set window fontface "Times New Roman"		// set font in graphs | "Arial" | "Times New Roman"


*** Open clean data set
	use DATA_clean, clear


*** Abbildung 2

	*Variablen Kodieren

	fre nss_russia_d4 nss_china_d4 nss_allies_d4 nss_nuclear_d4

	*Russland
	fre nss_russia_d4
	gen nss_oppose1 = 0 
	replace nss_oppose1 	= 100 if nss_russia_d4 == 1
	gen nss_neither1 = 0 
	replace nss_neither1 	= 100 if nss_russia_d4 == 2
	gen nss_support1 = 0 
	replace nss_support1 	= 100 if nss_russia_d4 == 3
	gen nss_dk1 = 0 
	replace nss_dk1 		= 100 if nss_russia_d4 == 4

	*China
	fre nss_china_d4
	gen nss_oppose2 = 0 
	replace nss_oppose2 	= 100 if nss_china_d4 == 1
	gen nss_neither2 = 0 
	replace nss_neither2 	= 100 if nss_china_d4 == 2
	gen nss_support2 = 0 
	replace nss_support2 	= 100 if nss_china_d4 == 3
	gen nss_dk2 = 0 
	replace nss_dk2			= 100 if nss_china_d4 == 4

	*Alliierte
	fre nss_allies_d4
	gen nss_oppose3 = 0 
	replace nss_oppose3		= 100 if nss_allies_d4 == 1
	gen nss_neither3 = 0 
	replace nss_neither3 	= 100 if nss_allies_d4 == 2
	gen nss_support3 = 0 
	replace nss_support3 	= 100 if nss_allies_d4 == 3
	gen nss_dk3 = 0 
	replace nss_dk3 		= 100 if nss_allies_d4 == 4

	*Abschreckung
	fre nss_nuclear_d4
	gen nss_oppose4 = 0 
	replace nss_oppose4 	= 100 if nss_nuclear_d4 == 1
	gen nss_neither4 = 0 
	replace nss_neither4 	= 100 if nss_nuclear_d4 == 2
	gen nss_support4 = 0 
	replace nss_support4 	= 100 if nss_nuclear_d4 == 3
	gen nss_dk4 = 0 
	replace nss_dk4 		= 100 if nss_nuclear_d4 == 4


	*Datensatz verkleinern und umformen
	keep nss_oppose1 nss_neither1 nss_support1 nss_dk1 nss_oppose2 nss_neither2 nss_support2 nss_dk2 nss_oppose3 nss_neither3 nss_support3 nss_dk3 nss_oppose4 nss_neither4 nss_support4 nss_dk4
	gen id = _n 
	reshape long nss_oppose nss_neither nss_support nss_dk, i(id) j(nss) string 


	*Abbildung erstellen
	#delimit ;
	graph hbar nss_oppose nss_neither nss_support,	stack over(nss, axis(noline) 
	relabel(1 `" "Das heutige Russland ist auf absehbare" "Zeit die größte Bedrohung für Frieden und" "Sicherheit im euroatlantischen Raum." "'
			2 `" "China ist Partner, Wettbewerber und" "systemischer Rivale." "'
			3 `" "Deutschlands Sicherheit ist untrennbar" "mit der unserer Alliierten und euro-" "päischen Partner verbunden." "'
			4 `" "Solange es Nuklearwaffen gibt, ist der" " Erhalt einer glaubwürdigen nuklearen" "Abschreckung für die NATO und für" "die Sicherheit Europas unerlässlich." "')
	label(labsize(med)) gap(*1))			
	scheme(plotplainblind)
	legend(off)
	blabel(bar, format(%9.0f) position(center) color(gs0) size(med))	// Prozentangaben in Balken einblenden
	bar(1, color(178 24 43) lcolor(gs16)) bar(2, color(gs12) lcolor(gs16)) bar(3, color(33 102 172) lcolor(gs16))
	ysize(2)
	xsize(3)
	yscale(off) ylab(, nogrid)
	ytitle(" ", size(med)) 
	title("", size(med))											// Titel
	text(7 104 "{bf:Lehne}", color(178 24 43) size(med))
	text(7 101 "{bf:ab}", color(178 24 43) size(med))
	text(23 104 "{bf:Teils/}", color(gs12) size(med))
	text(23 101 "{bf:teils}", color(gs12) size(med))
	text(62 102.5 "{bf:Stimme zu}", color(33 102 172) size(med))
	plotregion( margin(3 0 0 0) lstyle(none) ) 
	graphregion(margin(-5 -8 0 10) color(white) lwidth(huge) lstyle(none))	
	name(item1, replace)	// Name geben
	;
	#delimit cr
